<!DOCTYPE html>
<html lang="en">
	<head>
		<meta charset="utf-8">
		<title>Prototype</title>
		<link rel="stylesheet" href="<?php echo site_url("jqueryui/css/ui-lightness/jquery-ui-1.8.18.custom.css") ?>" type="text/css">
		<link rel="stylesheet" href="<?php echo site_url("bootstrap/css/bootstrap.css") ?>" type="text/css">
		<link rel="stylesheet" href="<?php echo site_url("datatables/media/css/jquery.dataTables.css") ?>" type="text/css">
		<script type="text/javascript" language="javascript" src="<?php echo site_url("jquery/jquery-1.7.1.min.js") ?>"></script>
		<script type="text/javascript" language="javascript" src="<?php echo site_url("bootstrap/js/bootstrap.js") ?>"></script>
		<script type="text/javascript" language="javascript" src="<?php echo site_url("datatables/media/js/jquery.dataTables.min.js") ?>"></script>
		<script type="text/javascript" language="javascript" src="<?php echo site_url("datatables/examples/examples_support/jquery.jeditable.js") ?>"></script>
		<script type="text/javascript" charset="utf-8">
			$(document).ready(function()
			{
				var oTable = $('#vendor-table').dataTable({
					"bProcessing": true,
					"bServerSide": true,
					"sAjaxSource": "<?php echo site_url('adminvendors/getvendors') ?>",
					"fnServerData" : function (sSource, aoData, fnCallback)
					{
						$.ajax(
						{
							"dataType": "json",
							"type": "POST",
							"url": sSource,
							"data": aoData,
							"success": fnCallback
						});
					},
					"fnDrawCallback": function () 
					{
						$("#vendor-table td:not(:nth-child(5))").editable("<?php echo base_url() ?>adminvendors/edit",
						{
							"placeholder" : "",
							"indicator" : "Saving...",
							"tooltip"   : "Click to edit...",
							"submitdata": function ( value, settings )
							{
								return {
									"prevalue": value,
									"column_index": oTable.fnGetPosition(this)[1],
									"row_id": this.parentNode.getAttribute("id")
								};
							},
							"height": "14px"
						});
					}
				});
			});
			
			function closedclicked(checked, userId)
			{
				$.ajax(
					{
						"type": "POST",
						"url": "<?php echo base_url() ?>adminvendors/closedchanged",
						"data" : {
							"checked" : checked,
							"userId" : userId
						},
						"success" : function(data){
						}
					}
				)
			}
		</script>
	</head>
	<body>
		<?php $this->load->view('v_adminnavbar'); ?>
		<div class="container">
			<div class="row">
				<div class="span12 ui-corner-all">
					<div class="well">
						<h1>Vendors</h1>
						<table id="vendor-table">
							<thead>
								<tr>
									<th>Vendor ID</th>
									<th>Name</th>
									<th>Email</th>
									<th>Source</th>
									<th>Status</th>
								</tr>
							</thead>
							<tbody>
							</tbody>
						</table>
					</div>
				</div>
			</div>
		</div>
	</body>
</html>